home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / SWAG9605.DDD / 0024_GIF Extract Utility.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-05-31  |  6.4 KB  |  270 lines

  1. {
  2. =============================================================
  3.  
  4. BLARF! A ** FAST ** GIF EXTRACT UTILITY BY SCOTT "CLEVER BOY"
  5. TUNSTALL (C) 1995.
  6.  
  7. -------------------------------------------------------------
  8.  
  9. What a lot of time I took to remove the swearing!! ;)
  10.  
  11.  
  12. This util will extract all of the files from the list in THING.DEF
  13. to a GIF which can then be edited.
  14.  
  15. Make sure you've got PLENTY of hard disk space, preferably
  16. 8 Mb or so, because there are obviously a lot of .GIF files that
  17. are going to be extracted. (Sorry, but I can't make them PCX)
  18.  
  19. HOW IT WORKS
  20. ------------
  21. First of all you gotta have :
  22.  
  23. (a) A file listing ALL of the graphic entries you want to rip out;
  24.     I've already made such a list for ya (THING.DEF);
  25.     Make a backup of it and load the backup into EDIT (Or somethin)
  26.     then place an asterisk before the entries ya don't want to make
  27.     into a GIF file. (Only those in between the *START and *END)
  28.     Make sure that no "white space" (tabs, spaces etc) between text
  29.     lines are left tho' (Carriage returns are OK between entries) !
  30.  
  31.     At the end of Thing.DEF note that there is *ENDFILE, this tells
  32.     this util that there is no more GIFS to extract. You MUST have
  33.     this here or you're shit outa luck!
  34.  
  35. (B) DMGRAPH handy! Yes, all this program does is repeatedly SHELL
  36.     to DMGRAPH! It's v. handy mind you.
  37.  
  38. (C) A GIF directory !
  39.  
  40.  
  41. Now:
  42. If you want to INSERT the graphic files listed in your own THING.DEF
  43. file, ya type :
  44.  
  45. BLARF -i <Name of text file [THING.DEF]> <Directory where gifs are>
  46.  
  47.  
  48.  
  49. So let's say you had a file called MONSTERS.TXT in C:\POONTANG dir,
  50. and that contained all of the names of the shit you wanted to rip out,
  51. and the directory where you wanted to read your gifs from is
  52. C:\GRAPHICS\GIF.
  53.  
  54. Ya type: BLARF -i C:\POONTANG\MONSTERS.TXT C:\GRAPHICS\GIF
  55.  
  56. Easy eh? (Mind and make a backup of your DOOM.WAD file !)
  57.  
  58.  
  59. On the other hand, if you wanted to EXTRACT some graphics
  60. you use:
  61.  
  62. BLARF -e <Name of text file listing monster pics to copy> <Directory where
  63. gifs go to>
  64.  
  65.  
  66. Piece of piss eh?
  67.  
  68.  
  69. Example:
  70.  
  71.  
  72. *START
  73. TROOPA1
  74. ...
  75. *SARGA1
  76. ...
  77. PAINA1
  78. *END
  79. ENDFILE
  80.  
  81.  
  82. Means that all objects from TROOPA1 to PAINA1 shall be extracted, 
  83. with the exception of SARGA1.
  84. ENDFILE means "Stop scanning"
  85.                    
  86.  
  87.  
  88. Oh yeah, if you ever use this program I'd like some kind of feedback
  89. pleeze.   (Bear with my slang, I'm trying to make an impression
  90. that I can kick ass  :^)  )
  91. }
  92.  
  93.  
  94. Program Blarf;
  95.  
  96. Uses Dos, Crt;
  97.  
  98.  
  99. {$M 4000,0,0}
  100.  
  101. Var TheTextFile: text;
  102.     FirstParam: String[2];
  103.     SecondParam: PathStr;
  104.     GifDirectoryName: PathStr;
  105.     Entry: string[8];
  106.     Extract: boolean;
  107.  
  108. Procedure ShellDMGraph(Parameters:string);
  109. Begin
  110.      SwapVectors;
  111.      Exec('DMGRAPH.EXE',Parameters);
  112.      SwapVectors;
  113. End;
  114.  
  115.  
  116.  
  117.  
  118. Procedure OpenTheTextFile;
  119. Begin
  120.      Assign(TheTextFile,SecondParam);
  121.      {$I-}
  122.      Reset(TheTextFile);
  123.      {$I+}
  124.      If IoResult <> 0 Then
  125.         Begin
  126.         Writeln;
  127.         Writeln('Could not find the text file required !');
  128.         Halt(0);
  129.      End;
  130. End;
  131.  
  132.  
  133.  
  134.  
  135. Function GetNextEntry: String;
  136. Var CharacterName: string;
  137. Begin
  138.      If Not Eof(TheTextFile) Then
  139.         Begin
  140.         ReadLn(TheTextFile,CharacterName);
  141.         While CharacterName[Length(CharacterName)]=' ' do
  142.               CharacterName:=Copy(CharActerName,1,Length(CharacterName)-1);
  143.         End
  144.      Else
  145.          CharacterName:='*ENDFILE';
  146.  
  147.      GetNextEntry:=CharacterName;
  148. End;
  149.  
  150.  
  151.  
  152.  
  153. Procedure CloseTheTextFile;
  154. Begin
  155.      Close(TheTextFile);
  156.      Writeln;
  157.      Writeln('Operation complete.');
  158. End;
  159.  
  160.  
  161.  
  162.  
  163. Procedure InsertGifs;
  164. Begin
  165.      OpenTheTextFile;
  166.  
  167.      Entry:=GetNextEntry;
  168.  
  169.      While Entry <> '*ENDFILE' do
  170.      Begin
  171.           If Entry[1] <> '*' Then
  172.              Begin
  173.              Writeln('Inserting ',Entry,'.GIF ..');
  174.              ShellDMGraph(Entry + ' ' + '-i ' + GIFDirectoryName+ Entry+'.GIF');
  175.           End;
  176.           Entry:=GetNextEntry;
  177.      End;
  178.  
  179.      CloseTheTextFile;
  180. End;
  181.  
  182.  
  183.  
  184.  
  185. Procedure ExtractGifs;
  186. Begin
  187.      OpenTheTextFile;
  188.      Extract:=False;
  189.  
  190.      Entry := GetNextEntry;
  191.  
  192.      While Entry <> '*ENDFILE' do
  193.      Begin
  194.           If (Entry[1] <> '*') And (Extract = True) Then
  195.              Begin
  196.              Writeln('Extracting ',Entry,'to ',GIFDirectoryName+Entry+'.GIF ..');
  197.              ShellDMGraph(Entry + ' ' + '-e ' + GIFDirectoryName+ Entry+'.GIF');
  198.              End
  199.           Else
  200.               If Entry='*START' Then
  201.                  Extract:=True
  202.               Else
  203.                   If Entry = '*END' Then
  204.                      Extract:=False;
  205.  
  206.           Entry:=GetNextEntry;
  207.      End;
  208.  
  209.      CloseTheTextFile;
  210. End;
  211.  
  212.  
  213.  
  214.  
  215. Procedure FuckedUp;
  216. Begin
  217.      Writeln;
  218.      Writeln('BLARF v1.1 Multiple GIF extractor/insertor for DOOM.');
  219.      Writeln('(C) Scott Tunstall 1995. So don''t mess with it!');
  220.      Writeln;
  221.      Writeln('Usage :');
  222.      Writeln;
  223.      Writeln('BLARF < -i/-e > <Text File> <Gif Directory>');
  224.      Writeln;
  225.      Writeln('-i will INSERT the GIFS into DOOM.WAD .');
  226.      Writeln('-e will EXTRACT the GIFS from DOOM.WAD .');
  227.      Writeln;
  228.      Writeln('Text file is standard EDIT created list of the graphics you');
  229.      Writeln('want extracted from DOOM.WAD for example SKY1 or TROOPA1 etc.');
  230.      Writeln('You can create the text file needed by DMGRAPH. (Thank f**k)');
  231.      Writeln('To make THING.DEF you type:');
  232.      Writeln;
  233.      Writeln('DMGRAPH >THING.DEF -c   (Make sure DMGRAPH is in yer DOOM dir!)');
  234.      Writeln;
  235.      Writeln('Mind and delete all of the ExMx stuff, SSectors, Nodes etc ''cos');
  236.      Writeln('they''ll screw up this program.');
  237.      Writeln;
  238.      Writeln('GIF directory is the source/destination of/for yer GIFS.');
  239.      Writeln;
  240. End;
  241.  
  242.  
  243.  
  244.  
  245.  
  246. Procedure YeDontSweatMuch;
  247. Begin
  248.      Writeln;
  249.      Writeln('Invalid parameter passed, -i or -e expected');
  250.      Writeln('Give me any more gyp and I''ll format yer hard disk !');
  251.      Writeln;
  252. End;
  253.  
  254.  
  255.  
  256. Begin
  257.      If ParamCount<>3 Then FuckedUp;
  258.      FirstParam:=ParamStr(1);       { switch }
  259.      SecondParam:=ParamStr(2);      { name of text file }
  260.      GIFDirectoryName:=ParamStr(3)+'\';       { name of GIF dir. }
  261.  
  262.      If (FirstParam = '-i') or (FirstParam = '-I') Then
  263.         InsertGifs
  264.      Else
  265.          If (FirstParam = '-e') or (FirstParam ='-E') Then
  266.             ExtractGifs
  267.          Else
  268.              YeDontSweatMuch;
  269. End.
  270.